//
//  findListCell.m
//  Find
//
//  Created by lanou3g on 15/10/27.
//  Copyright © 2015年 Reiko. All rights reserved.
//

#import "FindListCell.h"

@implementation FindListCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addSubviews];
    }
    return self;
}

#pragma mark -- 布局自定义cell (list界面)
- (void)addSubviews{
    // 用户图像
    self.mineImageView = [[UIImageView alloc] initWithFrame:CGRectMake(kFindListCellMineImageViewX, kFindListCellMineImageViewY, kFindListCellMineImageViewWidth, kFindListCellMineImageViewHeight)];
    self.mineImageView.backgroundColor = [UIColor orangeColor];
    self.mineImageView.layer.masksToBounds = YES;
    self.mineImageView.layer.cornerRadius = self.mineImageView.frame.size.width/2;
    [self.contentView addSubview:self.mineImageView];
    
    // 标题
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.mineImageView.frame)+kFindListCellTitleLabelToMineImageViewX, CGRectGetMinY(self.mineImageView.frame)+kFindListCellTitleLabelToMineImageViewY, kFindListCellTitleLabelWidth, kFindListCellTitleLabelHeight)];
//    self.titleLabel.backgroundColor = [UIColor grayColor];
    self.titleLabel.font = [UIFont boldSystemFontOfSize:kFindListCellTitleLabelFont];
    [self.contentView addSubview:self.titleLabel];
    
    // 距离
    self.distanceLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.titleLabel.frame)+kFindListCellDistanceLabelToTitleLabelX, CGRectGetMinY(self.titleLabel.frame)+kFindListCellDistanceLabelToTitleLabelY, kFindListCellDistanceLabelWidth, kFindListCellDistanceLabelHeight)];
//    self.distanceLabel.backgroundColor = [UIColor grayColor];
    self.distanceLabel.textAlignment = NSTextAlignmentCenter;
    self.distanceLabel.textColor = kFindListCellLabelTextColor;
    self.distanceLabel.font = [UIFont systemFontOfSize:kFindListCellDistanceLabelFont];
    [self.contentView addSubview:self.distanceLabel];
    
    
    // 详细
    self.detailLabel = [[UILabel alloc] initWithFrame:CGRectMake(kFindListCellDetailLabelX, CGRectGetMaxY(self.mineImageView.frame)+kFindListCellDetailLabelToMineImageViewY, kFindListCellDetailLabelWidth, kFindListCellDetailLabelHeight)];
//    self.detailLabel.backgroundColor = [UIColor grayColor];
    self.detailLabel.numberOfLines = 0;
    self.detailLabel.font = [UIFont systemFontOfSize:kFindListCellDetailLabelFont];
    [self.contentView addSubview:self.detailLabel];
    
    // 地点图标
    self.addressImageView = [[UIImageView alloc] initWithFrame:CGRectMake(kFindListCellAddressImageViewX, CGRectGetMaxY(self.detailLabel.frame)+kFindListCellAddressImageViewToDetailLabelY, kFindListCellAddressImageViewWidth, kFindListCellAddressImageViewHeight)];
//    self.addressImageView.backgroundColor = [UIColor orangeColor];
    [self.contentView addSubview:self.addressImageView];
    
    // 地址信息
    self.addressLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.addressImageView.frame)+kFindListCellAddressLabelToAddressImageViewX, CGRectGetMinY(self.addressImageView.frame)+kFindListCellAddressLabelToAddressImageViewY, kFindListCellAddressLabelWidth, kFindListCellAddressLabelHeight)];
//    self.addressLabel.backgroundColor = [UIColor grayColor];
    self.addressLabel.textColor = kFindListCellLabelTextColor;
    self.addressLabel.font = [UIFont systemFontOfSize:kFindListCellAddressLabelFont];
    [self.contentView addSubview:self.addressLabel];
    
    // 发布时间
    self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.addressLabel.frame)+kFindListCellTimeLabelToAddressLabelX, CGRectGetMinY(self.addressLabel.frame)+kFindListCellTimeLabelToAddressLabelY, kFindListCellTimeLabelWidth, kFindListCellTimeLabelHeight)];
//    self.timeLabel.backgroundColor = [UIColor grayColor];
    [self.contentView addSubview:self.timeLabel];
    self.timeLabel.textAlignment = NSTextAlignmentCenter;
    self.timeLabel.textColor = [UIColor grayColor];
    self.timeLabel.font = [UIFont systemFontOfSize:kFindListCellTimeLabelFont];
    
    
    
}







- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
